package com.zhou.JavaAndroidFirm.presenter;

import com.zhou.JavaAndroidFirm.app.AppToast;
import com.zhou.JavaAndroidFirm.bean.NewsDetail;
import com.zhou.JavaAndroidFirm.constract.NewsDetailContract;
import com.zhou.JavaAndroidFirm.rx.RxSubscriber;

/**
 * @author Administrator
 * @date 2018/8/21 0021
 * @des
 */
public class NewsDetailPresenter extends NewsDetailContract.Presenter {
    @Override
    public void getOneNewsData(String postId) {
        addSubscribe(mModel.getOneNewsData(postId).subscribe(new RxSubscriber<NewsDetail>(mContext) {
            @Override
            protected void _onNext(NewsDetail newsDetail) {
                mView.returnOneNewsData(newsDetail);
            }

            @Override
            protected void _onError(String message) {
                AppToast.showToast(message);
            }
        }));
    }
}
